package com.topc.problem.model.vo;

import cn.hutool.core.util.ObjectUtil;
import com.topc.problem.model.po.ProblemTag;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Data
@Accessors(chain = true)
public class TagTreeShowVo {

    private Long id;

    private String name;

    private List<TagTreeShowVo> children;

    public TagTreeShowVo(ProblemTag problemTag) {
        this.name = problemTag.getName();
        this.id = problemTag.getId();
    }

    public void addChildren(TagTreeShowVo tagTreeShowVo){
        if (ObjectUtil.isEmpty(children)) children = new ArrayList<>();
        children.add(tagTreeShowVo);
    }


}
